package teamGiga.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import teamGiga.bean.MovieMemberBean;
import teamGiga.bean.QnaBean;
import teamGiga.dao.MovieDao;
import action.servlet.ActionForWard;

public class QnaInsertAction extends Action{
	private String path;
	private boolean redirect;
	public QnaInsertAction() {
		super();
	}
	public QnaInsertAction(String path, boolean redirect) {
		super();
		this.path = path;
		this.redirect = redirect;
	}
	@Override
	public ActionForWard execute(HttpServletRequest request,
			HttpServletResponse response) {
		// TODO Auto-generated method stub
		
		QnaBean bean = new QnaBean(0, (int)request.getSession().getAttribute("mbno"), 
									request.getParameter("nickname"), 
									request.getParameter("qnatitle"), 
									request.getParameter("qnacontents") 
									);
		
		try {
			MovieDao.insertQna(bean);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return new ActionForWard(path, redirect);
	}
	
}
